<?php 
include 'inc/reuse/dbconfig.php';
$sql = "SELECT * FROM products WHERE products_id=".$_GET['products_id'];

$rsd = mysql_query($sql);
$numOfRow = mysql_num_rows($rsd);
$dirname = "images/uploads/";
$images_slide = "";
$description = "";
$products_name = "";
$count = 0;
$aaa="";
if($numOfRow > 0)
{
	while($row = mysql_fetch_array($rsd)){
		$products_name = $row['products_name'];
		//เก็บข้อมูลรุปภาพสินค้า
		$images_dir = $dirname.$_GET['products_id'];
		if(is_dir($images_dir))
		{
			$images = scandir($images_dir);
			$ignore = Array(".", "..",".svn", "otherfiletoignore");
			foreach($images as $curimg){
				if(!in_array($curimg, $ignore)) {
					$images_slide .=  
								"<li>
									<a href=\"$images_dir/$curimg\">
									<img src=\"$images_dir/$curimg\" class=\"image$count\" width=\"150\" height=\"100\">
									</a>
								 </li>";	
				}
			}
		}
		//เก็บรายละเอียดสินค้า
		$description  = "<tr>
							<td>ชื่อสินค้า : ".$row['products_name']."</td>
						</tr>
                        <tr>
                        	<td>".nl2br($row['products_description'])."</td>
                        </tr>";
		$count++;
	}
}else{
	echo "ไม่มีสามารถเข้าหน้าสินค้าดังกล่าว";
}
?>